package com.lantosec.hmrp.modules.sysdata.entity;

import java.util.Date;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.sysdata.vo.SysDataSerialNumberVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 流水号规则表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-06-22
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysDataSerialNumber extends BaseEntity<SysDataSerialNumberVO> {

    private static final long serialVersionUID = 1L;
    public SysDataSerialNumber(SysDataSerialNumberVO vo){
        this.id = vo.getId();
        this.serialName = vo.getSerialName();
        this.serialDesc = vo.getSerialDesc();
        this.serialRules = vo.getSerialRules();
        this.startValue = vo.getStartValue();
        this.increment = vo.getIncrement();
        this.currentNumber = vo.getCurrentNumber();
        this.resetCycle = vo.getResetCycle();
        this.createTime = vo.getCreateTime();
        this.updateTime = vo.getUpdateTime();
    }

    @Override
    public SysDataSerialNumberVO convertToVO(){
        return new SysDataSerialNumberVO(this);
    }


    /**
     * ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 名称
     */
    private String serialName;

    /**
     * 描述
     */
    private String serialDesc;

    /**
     * 规则
     */
    private String serialRules;

    /**
     * 初始值
     */
    private Integer startValue;

    /**
     * 增量
     */
    private Integer increment;

    /**
     * 当前值
     */
    private Integer currentNumber;

    /**
     * 重置周期:年 YEAR，月 MONTH，周 WEEK，日 DAY
     */
    private String resetCycle;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;


    public enum ColName {
        id, serial_name, serial_desc, serial_rules, start_value, increment, current_number, reset_cycle, create_time, update_time, 
    }
}
